package com.xpsoft.oa.service.info.impl;


import java.util.List;

import org.apache.commons.lang.StringUtils;

import com.xpsoft.core.service.impl.BaseServiceImpl;
import com.xpsoft.oa.dao.info.CompanyRoleDao;
import com.xpsoft.oa.model.info.CompanyRole;
import com.xpsoft.oa.service.info.CompanyRoleService;

public class CompanyRoleServiceImpl extends BaseServiceImpl<CompanyRole> implements CompanyRoleService{
	private CompanyRoleDao dao;
	
	public CompanyRoleServiceImpl(CompanyRoleDao dao) {
		super(dao);
		this.dao=dao;
	}

	@Override
	public CompanyRole getByTitle(String title) {
		if(StringUtils.isNotBlank(title)){
			String hql = "from CompanyRole where title = ?";
			List<CompanyRole> list = dao.findByHql(hql, new Object[]{title});
			if(list!=null&&list.size()>0){
				return list.get(0);
			}
		}
		return null;
	}

}